import http from '@/api/http.js'
export default  {
	install(Vue){
		Vue.mixin({
			data(){
				return {
					globalExchangeRate: '￥'
				}
			},
			created(){
				this.globalExchangeRate= uni.getStorageSync('globalExchangeRate')
			},
			onLoad(){
				this.getGlobalExchangeRate();
			},
			methods: {
				// 汇率
				async getGlobalExchangeRate(){
					let params, infoRes;
						params = {
							method: "api/v2/system/exchange_rate"
						}
					infoRes = await http(params);
					if(infoRes.status){
						this.globalExchangeRate = infoRes.data;
						uni.setStorageSync('globalExchangeRate',infoRes.data)
					}else{
						uni.showToast({
							icon:'none',
							title:infoRes.msg
						})
						uni.setStorageSync('globalExchangeRate','')
					}
				}
			}
		})
	}
}